﻿$filePath = "D:\Docs\数据同步\对接表数据汇总.txt";
$content = Get-Content $filePath;
$lst = $content;

$output = "";
foreach ($line in $lst)
{
   $items = $line.Split("	",[StringSplitOptions]::RemoveEmptyEntries);
   if ($items.Length -lt 3)
   {
   Write-Host $items
       #continute;
       continue;
   }
   $flag = $items[0];
    $tableName = $items[1];
    $fieldNames = $items[2].Split(",",[StringSplitOptions]::RemoveEmptyEntries);
   if ($fieldNames.Length -gt 1)
   {
       foreach ($fieldName in $fieldNames)
       {
           $output +=  ($fieldName+","+[System.Environment]::NewLine);
       }
   }
   else
   {
     $fieldName = $fieldNames[0];
     $output +=  ($fieldName+","+[System.Environment]::NewLine);
   }
}

$outputPath ="f:/ttt_FieldNamesHasRepeat.txt";
$output >> $outputPath;

#////////////////////////////////////////////////////////////////////
#/////////////////////////////////////Distinct///////////////////////
#////////////////////////////////////////////////////////////////////
#$outputPath ="f:/ttt_distinctFieldNames.txt";
[System.Collections.Generic.HashSet[string]]$lines=Get-Content -Path $outputPath -ReadCount 0
$dpath = "f:/ttt_distinctFieldNames.txt";
   Set-Content  -Path $dpath -Value ($lines -join "`r`n")